﻿<cfscript>
/** 
* Senate Frameworks studentProperty
* 
* @hint "The student property object handler." 
*/ 

component 
	displayname="public.service.handler.studentProperty" 
	output=false 
	accessors=true 
	{

	/* PROPERTIES */
	property type="boolean" name="InSchool" default="false" hint="是否在校";
	property type="boolean" name="Recognized" default="false" hint="是否有学籍";
	property type="boolean" name="Register" default="false" hint="是否电子注册信息确认";

	property type="boolean" name="Degree" default="false" hint="是否颁发学位";
	property type="boolean" name="Graduate" default="false" hint="是否颁发毕业证";

	property type="boolean" name="Assist" default="false" hint="是否辅修";
	property type="boolean" name="Secondary" default="false" hint="是否双学位";

	property type="boolean" name="Nonresident" default="false" hint="是否走读生";
	property type="boolean" name="Abroad" default="false" hint="是否留学生";

	property type="boolean" name="OutCountry" default="false" hint="是否出国留学";
	property type="boolean" name="Exchanged" default="false" hint="是否交换生";

	property type="boolean" name="TakenPicutre" default="false" hint="是否有标准证件照片";

	property type="boolean" name="EarlyGraduate" default="false" hint="是否申请提前毕业";
	property type="boolean" name="EarlyGraduateReview" default="false" hint="是否申请提前进行毕业审核";

	property type="boolean" name="Advanced" default="false" hint="是否进修生";
	
	/* 学生费用及结算相关 */
	property type="boolean" name="Debt" default="false" hint="是否拖欠学费";
	property type="boolean" name="Poor" default="false" hint="是否享受贫困生绿色通道";
	
	/* 电子照片 */
	property type="boolean" name="HasPicture" default="false" hint="是否有电子照片";

	/**
	* @hint "初始化对象"
	* 
	* @InSchool "是否在校"
	* @Recognized "是否有学籍"
	* @Register "是否电子注册信息确认"
	* @Degree "是否颁发学位"
	* @Graduate "是否颁发毕业证"
	* @Assist "是否辅修"
	* @Secondary "是否双学位"
	* @Nonresident "是否走读生"
	* @Abroad "是否留学生"
	* @OutCountry "是否出国留学"
	* @Exchanged "是否交换生"
	* @TakenPicutre "是否有标准证件照片"
	* @EarlyGraduate "是否申请提前毕业"
	* @EarlyGraduateReview "是否申请提前进行毕业审核"
	* @Advanced "是否进修生"
	* @Debt "是否拖欠学费"
	* @Poor "是否享受贫困生绿色通道"
	* @HasPicture "是否有电子照片"
	*/
	public public.service.handler.studentProperty function init( boolean InSchool=false, boolean Recognized=false, boolean Register=false, 
																	boolean Degree=false, boolean Graduate=false, 
																	boolean Assist=false, boolean Secondary=false, 
																	boolean Nonresident=false, boolean Abroad=false, 
																	boolean OutCountry=false, boolean Exchanged=false,
																	boolean TakenPicutre=false, 
																	boolean EarlyGraduate=false, boolean EarlyGraduateReview=false,
																	boolean Advanced=false, 
																	boolean Debt=false, boolean Poor=false, 
																	boolean HasPicture=false ) output=false {
		setInSchool( arguments.InSchool );
		setRecognized( arguments.Recognized );
		setRegister( arguments.Register );
		
		setDegree( arguments.Degree );
		setGraduate( arguments.Graduate );
		
		setAssist( arguments.Assist );
		setSecondary( arguments.Secondary );
		
		setNonresident( arguments.Nonresident );
		setAbroad( arguments.Abroad );
		
		setOutCountry( arguments.OutCountry );
		setExchanged( arguments.Exchanged );
		
		setTakenPicutre( arguments.TakenPicutre );

		setEarlyGraduate( arguments.EarlyGraduate );
		setEarlyGraduateReview( arguments.EarlyGraduateReview );
		
		setAdvanced( arguments.Advanced );
		
		setDebt( arguments.Debt );
		setPoor( arguments.Poor );
		
		setHasPicture( arguments.HasPicture );
		
		return this;
	}

	/**
	* @hint "将上述属性转换为属性字符串"
	*/
	public string function stringProperty() output=false {
		
		var prop = "";
		
		/* 执行序列化 */
		if (getInSchool()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getRecognized()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getRegister()) { prop = prop & "1"; } else { prop = prop & "0"; }

		if (getDegree()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getGraduate()) { prop = prop & "1"; } else { prop = prop & "0"; }

		if (getAssist()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getSecondary()) { prop = prop & "1"; } else { prop = prop & "0"; }

		if (getNonresident()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getAbroad()) { prop = prop & "1"; } else { prop = prop & "0"; }

		if (getOutCountry()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getExchanged()) { prop = prop & "1"; } else { prop = prop & "0"; }
		
		if (getTakenPicutre()) { prop = prop & "1"; } else { prop = prop & "0"; }

		if (getEarlyGraduate()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getEarlyGraduateReview()) { prop = prop & "1"; } else { prop = prop & "0"; }
		
		if (getAdvanced()) { prop = prop & "1"; } else { prop = prop & "0"; }
		
		if (getDebt()) { prop = prop & "1"; } else { prop = prop & "0"; }
		if (getPoor()) { prop = prop & "1"; } else { prop = prop & "0"; }

		if (getHasPicture()) { prop = prop & "1"; } else { prop = prop & "0"; }

		return left(prop & "000000000000000000000000000000", 30);
	}
	
	/**
	* @hint "将属性字符串转换为对象属性"
	* 
	* @fString "属性字符串"
	*/
	public void function parseProperty( required string fString ) output=false {
		
		var i = 0;
		
		for (i=1; i <= len(arguments.fString); i++) {
			
			switch (i) {
				
				case 1:
					/* 第1位 是否在校 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setInSchool(true); } else { setInSchool(false); }
					break;

				case 2:
					/* 第2位 是否有学籍 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setRecognized(true); } else { setRecognized(false); }
					break;
				
				case 3:
					/* 第3位 是否电子注册 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setRegister(true); } else { setRegister(false); }
					break;
				
				case 4:
					/* 第4位 是否颁发学位 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setDegree(true); } else { setDegree(false); }
					break;
				
				case 5:
					/* 第5位 是否颁发毕业证 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setGraduate(true); } else { setGraduate(false); }
					break;
				
				case 6:
					/* 第6位 是否辅修 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setAssist(true); } else { setAssist(false); }
					break;
				
				case 7:
					/* 第7位 是否双学位 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setSecondary(true); } else { setSecondary(false); }
					break;
				
				case 8:
					/* 第8位 是否走读生 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setNonresident(true); } else { setNonresident(false); }
					break;
				
				case 9:
					/* 第9位 是否留学生 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setAbroad(true); } else { setAbroad(false); }
					break;
				
				case 10:
					/* 第10位 是否出国留学 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setOutCountry(true); } else { setOutCountry(false); }
					break;
				
				case 11:
					/* 第11位 是否交换生 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setExchanged(true); } else { setExchanged(false); }
					break;
				
				case 12:
					/* 第12位 是否有标准证件照 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setTakenPicutre(true); } else { setTakenPicutre(false); }
					break;
				
				case 13:
					/* 第13位 是否申请提前毕业 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setEarlyGraduate(true); } else { setEarlyGraduate(false); }
					break;
					
				case 14:
					/* 第14位 是否申请提前进行毕业审核 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setEarlyGraduateReview(true); } else { setEarlyGraduateReview(false); }
					break;
					
				case 15:
					/* 第15位 是否进修生 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setAdvanced(true); } else { setAdvanced(false); }
					break;
					
				case 16:
					/* 第16位 是否拖欠学费 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setDebt(true); } else { setDebt(false); }
					break;
				
				case 17:
					/* 第17位 是否享受贫困生绿色通道 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setPoor(true); } else { setPoor(false); }
					break;

				case 18:
					/* 第18位 是否有电子照片 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setHasPicture(true); } else { setHasPicture(false); }
					break;

			}
			
		}
		
	}	
}

</cfscript>